﻿using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace NetwerkScanner
{

    /// <summary>
    /// Hulp klasse voor treeviewitem databinding
    /// </summary>
    public class MultiCollectionConverter : IMultiValueConverter
    {

        public object Convert( object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture )
        {
            return values.Select(collection => new FolderNode {
                Name = collection.ToString(),
                Items = (IEnumerable)collection
            } ).ToArray( );
        }

        public object[] ConvertBack( object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture )
        {
            throw new NotImplementedException( );
        }

    }

    public class FolderNode
    {
        public string Name
        {
            get;
            set;
        }
        public System.Collections.IEnumerable Items
        {
            get;
            set;
        }
    }


}
